//
//  HYClientSocketCollectionViewCell.m
//  XPlayer
//
//  Created by 张水 on 2023/10/27.
//

#import "HYClientSocketCollectionViewCell.h"
#import "HYClientSocketModel.h"

@implementation HYClientSocketCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self){
        self.contentView.backgroundColor = AppContentBgThemeColor;
        [self configUI];
    }
    return self;
}

- (void)configUI
{
    [self.contentView addSubview:self.backView];
    [self.contentView addSubview:self.iconView];
    [self.contentView addSubview:self.bottomView];
    [self.bottomView addSubview:self.titleLabel];
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(self.contentView);
        make.height.mas_equalTo(40*KAdapterScale);
    }];
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.bottomView.mas_top).offset(-20);
        make.width.height.mas_equalTo(44);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.bottomView);
    }];
}

- (void)bindViewModel:(HYClientSocketModel *)vm
{
    self.iconView.image = [UIImage imageNamed:vm.imageName];
    self.titleLabel.text = vm.title;
}

@end
